<template>
	<el-button
		:icon="configure.icon ? ElementPlusIconsVue[configure.icon] : ''"
		:type="configure.type"
		:disabled="configure.disabled"
		@click="handleClick"
	>
		{{ configure.text }}
	</el-button>
</template>

<script lang="ts" setup>
import { PropType } from "vue";
import { ButtonType } from "./type";
import * as ElementPlusIconsVue from "@element-plus/icons-vue";
const props = defineProps({
	//配置项
	configure: {
		type: Object as PropType<ButtonType>,
		default: {
			text: "按钮",
		},
		required: true,
	},
});

const emits = defineEmits(["onClick"]);

const handleClick = () => {
	props.configure.click && props.configure.click();
	emits("onClick");
};
</script>
